package third;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;
import java.util.Collection;

/**
 * Json Mapping
 *
 * @author Michael.Wang
 * @date 2017/9/14
 */
@Data
@ToString
@EqualsAndHashCode
public class BusinessInfo implements Serializable {
    // 即迁移到wid，子账号迁移后回写wid
    private Long id;

    private Long aid;

    // 迁移完成后续到子账号表
    private Long pid;

    // 存储子账号表id，回写时用作where条件用
    private Long rabc_account_id;

    private String status;
    private String username;
    private String password;
    private String name;
    private String agentId;
    private String province;
    private String city;
    private String country;
    private String address;
    private String mobile;
    private String email;
    private String qq;
    private String pubLimit;
    private String copyrightHide;
    private String serviceId;
    private String payType;
    private String postpone;
    private String lotteryAmount;
    private String lotteryBalance;
    private String btime;
    private String etime;
    private String isBind;
    private String isLocked;
    private String ltime;
    private String ctime;
    private String flag;
    private String newPassword;
    private String isChangeNewPassword;
    private String isChangeFlag;
    private String level;
    private String storeNum;

    private Long parentBid;

    private int pidNum;

    public static BusinessInfo find(Collection<BusinessInfo> businessInfos, Long bid) {
        if (bid == null || businessInfos == null) {
            return null;
        }

        for (BusinessInfo businessInfo : businessInfos) {
            if (bid.equals(businessInfo.getId())) {
                return businessInfo;
            }
        }
        return null;
    }
}